using System;
using System.Collections.Generic;
using System.Text;

using Sandia.MVCFramework.Data;

namespace Sandia.MVCFramework.Common
{
    /// <summary>
    /// Interface to be implemented by classes that
    /// handle subscription requests and publish data
    /// to the appropriate subscribers
    /// </summary>
    public interface IPublisher
    {
        /// <summary>
        /// Handle a request for a subscription
        /// from a specified subscriber for a
        /// specified data type
        /// </summary>
        /// <param name="subscriber">The subscriber
        /// making the subscription request</param>
        /// <param name="dataType">The data type
        /// to subscribe to</param>
        void Subscribe(
            ISubscriber subscriber,
            Type dataType);

        /// <summary>
        /// Remove subscription to the specified data type for the given
        /// subscriber.
        /// </summary>
        /// <param name="subscriber">The subscriber
        /// to remove</param>
        /// <param name="dataType">The data type
        /// to remove from</param>
        void RemoveSubscription(
            ISubscriber subscriber,
            Type dataType);

        /// <summary>
        /// Publish data to any MVC Framework element
        /// subscribing to it
        /// </summary>
        /// <param name="dataPacket">The data packet to be published</param>
        void PublishData(DataPacket dataPacket);
    }
}
